package com.wlient.basic.Sort;//java程序实现

import java.io.*;

public class GcdLcm {
    public static int gcdOf(int m, int n) {
        int r;
        while (n != 0) {
            r = m % n;
            m = n;
            n = r;
        }
        return m;
    }

    public static int lcmOf(int m, int n) {
        return m * n / gcdOf(m, n);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader ln = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("请输入第一个数：");
        int x = Integer.parseInt(ln.readLine());
        System.out.print("请输入第二个数：");
        int y = Integer.parseInt(ln.readLine());
        //System.out.println("GCD of (" + x + "," + y + ")=" + GcdLcm.gcdOf(x, y));
        //System.out.println("LCM of (" + x + "," + y + ")=" + GcdLcm.lcmOf(x, y));
        System.out.println(GcdLcm.gcdOf(x, y) + "," + GcdLcm.lcmOf(x, y));
        int sum = x * y;


        int i = 0;
        if (y != 0) {
            i = y % x;
            y = x;
            x = i;
        }
        System.out.println(i);

        System.out.println(sum / i);
    }
}